package com.yc.base.service.impl;


import com.yc.base.dao.UserDao;
import com.yc.base.mapper.UserMapper;
import com.yc.base.model.TSUser;
import com.yc.base.support.utils.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl extends BaseService<TSUser, String> {

	@Autowired
	private UserDao userDao;
	@Autowired
	private UserMapper userMapper;
	@Autowired
	private IdWorker idWorker;

	//测试dao
	public TSUser findCustomer(String id) {
		return userDao.findCustomer(id);
	}

	//测试mapper
	public TSUser testU(String id) {
		return userMapper.testU(id);
	}

	/**
	 * 判断用户名是否存在
	 */
	public TSUser queryUsernameIsExist(String username) {
		return userDao.findByUsername(username);
	}

	/**
	 * 用户注册
	 */
	public TSUser saveUser(TSUser user) {
//		String userId = idWorker.nextId();
		return userDao.save(user);
	}

}
